We are migrating the bug tracker to github Issues. This is now the preferred way to report NASM bugs.
Self-registration is disabled due to spam issue (mail gorcunov@gmail.com or hpa@zytor.com to create an account)
The warnings from the OMF OBJ format about unsupported alignment values is never displayed. It is generated here: https://github.com/netwide-assembler/nasm/blob/9ea92eab6e26b5527e2dc72424a886a1a4061a48/output/outobj.c#L1487 In the following test, nasm is my current production version of NASM. ~/proj/nasm/nasm is a patched variation on the current git head. The patch is as follows: diff --git a/output/outobj.c b/output/outobj.c index f8dd7b71..ff66fc7c 100644 --- a/output/outobj.c +++ b/output/outobj.c @@ -1484,6 +1484,7 @@ static int32_t obj_segment(char *name, int *bits) case 4096: /* PharLap extension */ break; case 8: + nasm_nonfatal("foo"); nasm_warn(WARN_OTHER, "OBJ format does not support alignment" " of 8: rounding up to 16"); seg->align = 16; Test run: test$ cat test.asm section QUUX class=QUUX db 26h section FOO align=BAR class=FOO align BAR nop section STACK class=STACK stack align=16 resb 512 test$ ~/proj/nasm/nasm -f obj test.asm -DBAR=8 -o test8.obj -Wall test.asm:5: error: foo test.asm:5: warning: OBJ format does not support alignment of 8: rounding up to 16 [-w+other] test$ nasm -v NASM version 2.16.02rc2 compiled on Oct 12 2023 test$ nasm -f obj test.asm -DBAR=8 -o test8.obj -Wall test$ Without the nasm_nonfatal patch, the current git head also doesn't show the warning at all.
Removing the align BAR directive does not change the result.
The code that adjusts the alignment does seem to run. The following test shows how NASM encodes the alignment, and the encoding matches what is expected (8 rounded to 16, and 32 + 64 + 128 rounded to 256, higher rounded to 4096). Test done using https://github.com/boeckmann/omfdump/blob/main/omfdump.c#L356 and warplink.exe renamed from https://pushbx.org/ecm/download/old/warplink/20240801.zip wl.exe and https://hg.pushbx.org/ecm/msdos4/file/181bc2652e51/warplink.sh test$ for bar in 0 1 2 3 4 8 16 32 64 128 256 512 1024 2048 4096 8192; do echo -ne "$bar: " && nasm -DBAR=$bar test.asm -f obj && ~/proj/omfdump/omfdump test.obj | grep PUBLIC | tail -n1; ~/proj/msdos4.hg/hg/warplink.sh /mx test.obj,test.exe,test.map\; > /dev/null && cat test.map | perl -pe 's/\s+TEST.ASM\s+TEST.OBJ//' | grep PUBLIC | grep FOO; done 0: test.asm:5: error: invalid alignment value 0 test.asm:6: error: segment alignment `0' is not power of two test.asm:6: error: division by zero 1: BYTE (A1) PUBLIC (C2) USE16 size 0001 FOO 0000:0001 0001h BYTE PUBLIC FOO 2: WORD (A2) PUBLIC (C2) USE16 size 0001 FOO 0000:0002 0001h WORD PUBLIC FOO 3: test.asm:5: error: invalid alignment value 3 test.asm:6: error: segment alignment `3' is not power of two 4: DWORD (A5) PUBLIC (C2) USE16 size 0001 FOO 0000:0001 0001h PAGE PUBLIC FOO 8: PARA (A3) PUBLIC (C2) USE16 size 0001 FOO 0001:0000 0001h PARA PUBLIC FOO 16: PARA (A3) PUBLIC (C2) USE16 size 0001 FOO 0001:0000 0001h PARA PUBLIC FOO 32: PAGE (A4) PUBLIC (C2) USE16 size 0001 FOO 0010:0000 0001h PAGE PUBLIC FOO 64: PAGE (A4) PUBLIC (C2) USE16 size 0001 FOO 0010:0000 0001h PAGE PUBLIC FOO 128: PAGE (A4) PUBLIC (C2) USE16 size 0001 FOO 0010:0000 0001h PAGE PUBLIC FOO 256: PAGE (A4) PUBLIC (C2) USE16 size 0001 FOO 0010:0000 0001h PAGE PUBLIC FOO 512: LTL (A6) PUBLIC (C2) USE16 size 0001 FOO 0000:0001 0001h PAGE PUBLIC FOO 1024: LTL (A6) PUBLIC (C2) USE16 size 0001 FOO 0000:0001 0001h PAGE PUBLIC FOO 2048: LTL (A6) PUBLIC (C2) USE16 size 0001 FOO 0000:0001 0001h PAGE PUBLIC FOO 4096: LTL (A6) PUBLIC (C2) USE16 size 0001 FOO 0000:0001 0001h PAGE PUBLIC FOO 8192: test.asm:5: error: invalid alignment value 8192 test$
I fixed WarpLink so that it supports DWORD and 4KIB alignment in the same way that NASM does. The prior revision was used in one of the above tests. Changeset: https://hg.pushbx.org/ecm/warplink/ Build download will be at: https://pushbx.org/ecm/download/old/warplink/20250828.zip
Correction, the WarpLink changeset is at https://hg.pushbx.org/ecm/warplink/rev/6ab94e11b3cb
New WarpLink revision in https://hg.pushbx.org/ecm/warplink/rev/bfd7729482b8 The prior patch had a bug where stack segments would have some padding added wrongly. The new build will be available at https://pushbx.org/ecm/download/old/warplink/20250829.zip
Fixed the warning on the current master branch (will be in 3.00rc4.)